Building the Application
The frontend uses Vite as the build tool and outputs production-ready files to thedist/ folder.
Build for production
Run the build command to create optimized production assets:This command:
- Compiles TypeScript to JavaScript (
tsc -b) - Bundles and optimizes assets with Vite
- Minifies JavaScript and CSS
- Outputs static files to the
dist/directory
Environment Variables
Configuring the API URL
For production deployments, update theBASE_URL constant in src/api/client.ts:
-
Create a
.env.productionfile: -
Update
src/api/client.ts: -
Rebuild the application:
Deployment Options
The built application in thedist/ folder contains static files that can be deployed to any static hosting service.
Vercel
Deploy
From the Or connect your GitHub repository in the Vercel dashboard for automatic deployments.
Iquea_front directory:Netlify
Static Hosting (Nginx, Apache, S3)
For traditional web servers or cloud storage:-
Build the application:
-
Upload the contents of the
dist/folder to your web server -
Configure your server to:
- Serve
index.htmlfor all routes (for React Router) - Enable gzip/brotli compression
- Set appropriate cache headers
- Serve
Nginx Configuration Example
Production Optimizations
Build Size Optimization
Vite automatically performs several optimizations:- Code splitting for better caching
- Tree shaking to remove unused code
- Minification of JavaScript and CSS
- Asset optimization
Performance Best Practices
- Enable compression - Configure your hosting provider to serve gzip or brotli compressed assets
-
Configure CDN - Use a CDN for faster global delivery:
- Cloudflare
- AWS CloudFront
- Google Cloud CDN
-
Set cache headers - Configure long cache times for static assets:
- Enable HTTP/2 - Ensure your hosting supports HTTP/2 for better performance
-
HTTPS - Always use HTTPS in production:
- Required for secure authentication
- Improves SEO
- Enables modern web features
Verifying the Deployment
After deployment, verify:- All pages load correctly
- API calls connect to the production backend
- Authentication flow works properly
- Images and assets load correctly
- React Router navigation works on all routes
- Console shows no errors
Troubleshooting
Blank Page After Deployment
- Check browser console for errors
- Verify the API URL is correct
- Ensure server is configured to serve
index.htmlfor all routes
API Connection Failures
- Verify CORS configuration on the backend
- Check that the API URL in environment variables is correct
- Ensure HTTPS is used if the frontend is on HTTPS
404 Errors on Page Refresh
- Configure your server to redirect all routes to
index.html - See server configuration examples above